<template>
	<view class="page-content">
		<u-loading-page :loading="loading"></u-loading-page>
		<u-empty v-if="list.length == 0" mode="list"></u-empty>
		<u-cell-group v-else customStyle='background-color: white;'>
			<u-cell v-for="(item, index) in list" size="large" clickable :name="item.id">
				<view slot="title" class="u-slot-title">
					<text class="u-cell-text">上报时间:</text>
					<text class="u-cell-text">{{ item.上报时间 }}</text>
				</view>
				<view slot="value">
					<text class="u-cell-text">报警编码:</text>
					<text class="u-cell-text">{{ item.报警编码 }}</text>
				</view>
			</u-cell>
		</u-cell-group>
	</view>
</template>

<script>
	import {
		transformPostBody,
		transformRequestURL
	} from "@/utils/requestParams.js";
	import {
		QueryDeviceInstallList,
		addDeviceInstall,
		updateDeviceInstall,
		getDeviceInstall,
		delDeviceInstall,
		QueryDeviceInstallHistory
	} from "@/api/elder/DeviceInstall.js";

	export default {
		data() {
			return {
				id: null,
				list: [], // 列表数据
				page: 1, // 当前页数
				limit: 10, // 每页显示的条数
				showLoadmore: false, // 是否显示加载更多组件
				loading: false, // 是否正在加载中
				finished: false // 是否已经加载完所有数据
			}
		},
		onLoad: function(options) {
			this.id = options.id
		},
		onShow() {
			this.getList();
		},
		computed: {
			// getDetailAddress() {
			// 	return function (item) {
			// 		let result = "";
			// 		if (item.roomNum) result += item.roomNum
			// 		if (item.residenceAdd) result += item.residenceAdd
			// 		return result
			// 	}
			// },
		},
		methods: {
			getList() {
				this.loading = true;
				QueryDeviceInstallHistory(this.id).then((response) => {
					console.log('response', response)
					if (response.code == 200) {
						this.list = response.rows
					}
					this.loading = false;
				});
			},
		},
	}
</script>

<style lang="scss">
	page {
		background-color: white;
		display: flex;
		justify-content: center;
	}

	.page-content {
		width: 93%;
	}

	.custom-style {
		width: 80%;
		font-weight: bolder;
		font-size: 17px;
	}
</style>